package com.tuo51.childcare.domain.bize;

import com.tuo51.foudation.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * 测评的详细记录，老师做过的选择
 */

@Data
@Entity
@Table(name = "bize_record_answer", uniqueConstraints = {
        @UniqueConstraint(columnNames = {
                "questionId", "staffId", "recordId"
        })
})
@EqualsAndHashCode(callSuper = true)
public class BizEvaluateRecordAnswer extends Domain{

    @Column(columnDefinition = "varchar(32) COMMENT '测评题目id' ")
    private String questionId;

    public static BizEvaluateRecordAnswer of(String questionId, String staffId, String recordId,
                                            String dimensionScoreId, Integer month,
                                            String title, String answer, Integer answerId,  Integer score) {

        BizEvaluateRecordAnswer ret = new BizEvaluateRecordAnswer();
        ret.questionId = questionId;
        ret.staffId = staffId;
        ret.recordId = recordId;
        ret.dimensionScoreId = dimensionScoreId;
        ret.month = month;
        ret.title = title;
        ret.answer = answer;
        ret.answerId = answerId;
        ret.answerScore = score;

        return ret;
    }

    public void set(String dimensionScoreId, Integer month, String title, String answer, Integer answerId,  Integer score) {
        this.dimensionScoreId = dimensionScoreId;
        this.month = month;
        this.title = title;
        this.answer = answer;
        this.answerId = answerId;
        this.answerScore = score;
    }

    @Column(columnDefinition = "varchar(32) COMMENT '测评用户id' ")
    private String staffId;

    @Column(columnDefinition = "varchar(32) COMMENT '测评记录id' ")
    private String recordId;

    @Column(columnDefinition = "varchar(32) COMMENT '维度总分' ")
    private String dimensionScoreId;

    @Column(columnDefinition = "int default 0 COMMENT '测评归属月龄'")
    private Integer month = 0;

    @Column(columnDefinition = "varchar(50) COMMENT '测评题目标题' ")
    private String title;

    @Column(columnDefinition = "varchar(50) COMMENT '答案标题' ")
    private String answer;

    @Column(columnDefinition = "int default 0 COMMENT '答案id' ")
    private Integer answerId;

    @Column(columnDefinition = "int COMMENT '答案得分' ")
    private Integer answerScore;



}
